<?php 
  /**
   * Kontrollbase
   *
   * An open source MySQL monitoring and analytics application
   *
   * @package Kontrollbase
   * @author Matt Reid
   * @copyright Copyright (c) 2009 Matt Reid, Kontrollbase LLC
   * @license http://kontrollsoft.com/kontrollbase/userguide/general-LICENSE.php
   * @link http://kontrollbase.com
   */

if (!defined('BASEPATH')) exit('No direct script access allowed');

class Model_commandmap extends Model
{

  function __construct()
  {
    $this->Model_commandmap();
  }
  
  function Model_commandmap()
  {
    parent::Model();
  }

  function delete_data($id) {
    log_message('debug', "model_commandmap: delete_data called");
    log_message('debug', "model_commandmap: id: $id");
    $id = $this->db->escape_str($id);

    $dbr = $this->load->database('write', TRUE);
    $sql0="DELETE from `template_command_objects_map` WHERE id = '$id' LIMIT 1;";
    log_message('debug', "$sql0");

    $this->db->trans_start();
    $this->db->query($sql0);
    $this->db->trans_complete();
    if ($this->db->trans_status() === FALSE) {
      log_message('debug', "model_templates delete_data transaction failed");
      $this->db->trans_off();
      return 1;
    } 
    else {
      log_message('debug', "model_templates delete_data transaction success");
      $this->db->trans_off();
      return 0;
    }
  }
}
?>